using System;
using System.Collections.Generic;
//+
namespace ESVBible.Service.Parameter
{
    /// <summary>
    /// Parameters representing the passageQuery function, proving access to passages.
    /// </summary>
    public class PassageQueryParameter : Parameter, IDefaultOptimization
    {
        private String passage;

        //+
        //- @Passage -//
        /// <summary>
        /// The passage you want to display. It accepts a wide variety of input formats (e.g., Isaiah 1, Isa 1, and Is 1 all go to Isaiah 1).
        /// </summary>
        public String Passage
        {
            get
            {
                if (String.IsNullOrEmpty(passage))
                {
                    throw new ESVBibleException("Passage (the passage you want to display) is required");
                }
                return passage;
            }
            set
            {
                passage = value;
            }
        }

        //- @XPath -//
        /// <summary>
        /// XPath query used for finding values in returned XML document.
        /// </summary>
        public String XPath { get; set; }

        //- @XPathSet -//
        /// <summary>
        /// XPath query set used for finding values in returned XML document.  This prompts PassageQueryValueViaXPathMulti to return an array of Strings.
        /// </summary>
        public String[] XPathSet { get; set; }

        //+
        //- @PassageQueryParameters -//
        public PassageQueryParameter() { }

        //+
        //- $IDefaultOptimization.GetSettingsList -//
        Dictionary<String, String> IDefaultOptimization.GetSettingsList()
        {
            Dictionary<String, String> d = new Dictionary<String, String>();
            //+
            if (!String.IsNullOrEmpty(this.Passage)) ArgumentListManager.AddArgument(d, "passage", this.Passage);
            //+
            return d;
        }
    }
}